package logic.strategy;

import java.util.HashMap;
import java.util.Stack;

import logic.Country;
import logic.Player;
import logic.moves.AddSoldierMove;
import logic.moves.GameMove;

public class EliminateStrategy extends Strategy {
	//===	Constructor	===
	public EliminateStrategy(Player playerToEliminate)
	{
		addSoldiers = new Stack<AddSoldierMove>();
		victim = playerToEliminate;
	}
	
	//===	Methods	===
	
	
	public HashMap<String, Country> getTargetCountries() {	
		return victim.getCountries();
	}
	
	@Override
	public GameMove getNextMove() {
		GameMove gm = null;
		if(player.getSoldiers() > 0 && addSoldiers.isEmpty())
		{
			fillAddSoldiersStack();
		}
		if(player.getSoldiers() > 0 && !addSoldiers.isEmpty())
		{
			return addSoldiers.pop();
		}
		return getAttackMove();
	}
	@Override 
	public boolean hasNextMove()
	{
		return(!player.isDefeated() &&(!addSoldiers.isEmpty() || player.getSoldiers() > 0 || getAttackMove() != null));
	}
	

}
